﻿namespace B.S.DataBase.MyWrite.API.Common
{
    public class IdentityService : IIdentityService
    {
        private readonly IHttpContextAccessor httpContextAccessor;

        public IdentityService(IHttpContextAccessor httpContextAccessor)
        {
            this.httpContextAccessor = httpContextAccessor;
            this.UserId = httpContextAccessor.HttpContext.User.FindFirst("UserId").Value;
            this.UserName = httpContextAccessor.HttpContext.User.FindFirst("UserName").Value;

        }

        public string UserId { get; set; }
        public string UserName { get; set; }
    }
    public interface IIdentityService
    {
        public string UserId { get; set; }
        public string UserName { get; set; }
    }
}
